package logic

import (
	"context"
	"homepage_srv/homepage"
	"homepage_srv/internal/dao"
	"homepage_srv/internal/svc"
	"smart-health-platforms/pkg"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodAlbumsLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodAlbumsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodAlbumsLogic {
	return &GoodAlbumsLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 商品相册列表
func (l *GoodAlbumsLogic) GoodAlbums(in *homepage.GoodAlbumsRequest) (*homepage.GoodAlbumsResponse, error) {
	albums, err := dao.GetGoodAlbums(in)
	if err != nil {
		pkg.Warn("商品图片查询失败")
		return nil, err
	}

	return &homepage.GoodAlbumsResponse{
		List: albums,
	}, nil
}
